package ua.edu.nuos.jeetraining2012.cms.dto;

import java.io.Serializable;
import java.util.Date;

/**
 * DTO to store info about upcoming HomeWork deadlines.
 * It can be used in sidebar to show users upcoming deadlines in HW section.
 *
 * @author Victor N. Ganichev victor.ganichev@gmail.com
 * @version 1.0 Date: 25.06.13 Time: 13:39
 * @since 1.0
 */
public class UpcomingHomeWorkDTO implements Serializable {

    /** Course ID. */
    private long courseId;

    /** Course Title. */
    private String courseTitle;

    /** Material Title. */
    private String materialTitle;

    /** Homework ID. */
    private long hwId;

    /** Homework due date. */
    private Date hwDueDate;

    // Constructors
    public UpcomingHomeWorkDTO() {}

    // Getters & Setters
    public long getCourseId() {
        return courseId;
    }

    public void setCourseId(long courseId) {
        this.courseId = courseId;
    }

    public String getCourseTitle() {
        return courseTitle;
    }

    public void setCourseTitle(String courseTitle) {
        this.courseTitle = courseTitle;
    }

    public long getHwId() {
        return hwId;
    }

    public void setHwId(long hwId) {
        this.hwId = hwId;
    }

    public Date getHwDueDate() {
        return hwDueDate;
    }

    public void setHwDueDate(Date hwDueDate) {
        this.hwDueDate = hwDueDate;
    }

    public String getMaterialTitle() {
        return materialTitle;
    }

    public void setMaterialTitle(String materialTitle) {
        this.materialTitle = materialTitle;
    }

    // Overrides
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UpcomingHomeWorkDTO that = (UpcomingHomeWorkDTO) o;

        if (courseId != that.courseId) return false;
        if (hwId != that.hwId) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (courseId ^ (courseId >>> 32));
        result = 31 * result + (int) (hwId ^ (hwId >>> 32));
        return result;
    }

    @Override
    public String toString() {
        return "UpcomingHomeWorkDTO{" +
                "course id=" + courseId +
                ", course title='" + courseTitle + '\'' +
                ", material title ='" + materialTitle + '\'' +
                ", hw id=" + hwId +
                ", hw due date=" + hwDueDate +
                '}';
    }
}
